package com.lizard.schedule.net.http.ssl;

import android.content.res.AssetManager;

import com.lizard.schedule.ScheduleApplication;

import java.io.IOException;
import java.io.InputStream;

/**
 * ssl相关帮助类
 */
public class ScheduleSslHelper {

    /**
     * 安卓https用到得ssl证书bks文件在asserts中的文件名
     */
    private static final String KEYSTORE_ASSERTS_NAME = "schedule.bks";

    /**
     * bsk文件密码
     */
    private static final String KEYSTORE_PWD = "naodiqek";

    public static SslHttpClient genSslHttpClient(){
        SslHttpClient sslHttpClient = null;
        try {
            AssetManager am = ScheduleApplication.applicationContext.getAssets();
            InputStream keystore = am.open(KEYSTORE_ASSERTS_NAME);
            sslHttpClient = new SslHttpClient(keystore, KEYSTORE_PWD);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sslHttpClient;
    }

}
